<?php


namespace App\Http\Controllers\applets\model;


use Illuminate\Support\Facades\DB;

class AppInstallModel
{
    public static function queryWhere($where,$field){
        return DB::table('t_app_install as i')
            ->Join('t_parent_app as a','i.parent_app_id','=','a.id')
            ->where($where)
            ->get($field);
    }

    public static function queryWhereTeacher($where,$field){
        return DB::table('t_app_install as i')
            ->Join('t_teacher_app as a','i.teacher_app_id','=','a.id')
            ->where($where)
            ->get($field);
    }

    public static function queryFirst($where,$field){
        return DB::table('t_app_install')->where($where)->first($field);
    }

    public static function delete($where){
        return DB::table('t_app_install')->where($where)->delete();
    }

    public static function queryWhereFirst($where,$field){
        return DB::table('t_app_install as i')
            ->leftJoin('t_parent_app as a','i.parent_app_id','=','a.id')
            ->where($where)
            ->first($field);
    }

    public static function queryLikeTeacher($where,$field){
        return DB::table('t_app_install as a')
            ->leftJoin('t_teacher_app as t','a.teacher_app_id','=','t.id')
            ->where($where)
            ->first($field);
    }

    public static function edit($where,$field){
        return DB::table('t_app_install')->where($where)->update($field);
    }

    public static function queryGet($where,$field){
        return DB::table('t_app_install')->where($where)->get($field);
    }

    public static function queryCount($where){
        return DB::table('t_app_install')->where($where)->count('id');
    }


}